<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/common/head.jsp"%>
<div class="right">
    <form action="${pageContext.request.contextPath}<c:if test="${opr == 'add'}">/supplier/add</c:if><c:if test="${opr == 'update'}">/supplier/update</c:if>" id="myForm" method="post">
        <table style="margin-left: 120px;margin-top:50px;line-height: 40px">
            <tr>
                <th>供货商编码:</th>
                <td><input id="supCode" name="supCode" type="text" value="${supplier.supCode}"></td>
            </tr>
            <tr>
                <th>供货商名称:</th>
                <td><input id="supName" name="supName" type="text" value="${supplier.supName}"></td>
            </tr>
            <tr>
                <th>联系电话:</th>
                <td><input id="supPhone" name="supPhone" type="text" value="${supplier.supPhone}"></td>
            </tr>
            <tr>
                <th>联系人:</th>
                <td><input id="supContact" name="supContact" type="text" value="${supplier.supContact}"></td>
            </tr>
            <tr>
                <th>联系地址:</th>
                <td><input id="supAddress" name="supAddress" type="text" value="${supplier.supAddress}"></td>
            </tr>
            <tr>
                <th>传真:</th>
                <td><input id="supFax" name="supFax" type="text" value="${supplier.supFax}"></td>
            </tr>
            <tr>
                <th>备注:</th>
                <td><input id="supDesc" name="supDesc" type="text" value="${supplier.supDesc}"></td>
            </tr>
            <tr style="display: none">
                <th>id：</th>
                <td><input type="text" name="id" value="${supplier.id}"></td>
            </tr>
        </table>
        <input type="submit" value="提交" style="width: 80px;height: 30px;margin-left: 160px;text-align: center;">
    </form>
</div>
</section>
<script src="${pageContext.request.contextPath}/statics/js/jquery-1.8.3.min.js"></script>
<script>
    $(document).ready(function (){
        $("#myForm").submit(function (){
            var supCode = $("#supCode").val();
            var supName = $("#supName").val();
            var supPhone = $("#supPhone").val();
            var supContact = $("#supContact").val();
            var supAddress = $("#supAddress").val();
            var supFax = $("#supFax").val();
            var supDesc = $("#supDesc").val();
            if (supCode == null || supCode == ""){
                alert("供货商编码不能为空！");
                return false;
            }
            if (supName == null || supName == ""){
                alert("供货商名称不能为空！");
                return false;
            }
            if (supPhone == null || supPhone == ""){
                alert("联系电话不能为空！");
                return false;
            }
            if (supContact == null || supContact == ""){
                alert("联系人不能为空！");
                return false;
            }
            if (supAddress == null || supAddress == ""){
                alert("联系地址不能为空！");
                return false;
            }
            if (supFax == null || supFax == ""){
                alert("传真不能为空！");
                return false;
            }
            if (supDesc == null || supDesc == ""){
                alert("备注不能为空！");
                return false;
            }
            return true;
            // return false;
        })
    })
</script>
<%@include file="/WEB-INF/jsp/common/foot.jsp" %>
